<?xml version="1.0"?>
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:html="http://www.w3.org/1999/xhtml">
  <atom:id>http://bill.welliver.org/atom/smartos/Bhyve-ready NetBSD Images</atom:id>
  <atom:title type="text">electronic.alchemy :: Bhyve-ready NetBSD Images</atom:title>
  <atom:updated>2026-05-07T21:47:38-04:00</atom:updated>
  <atom:link href="http://bill.welliver.org/atom/smartos/Bhyve-ready NetBSD Images" type="application/atom+xml"></atom:link>
  <atom:link href="http://bill.welliver.org/space/smartos/Bhyve-ready NetBSD Images" type="text/html"></atom:link>
  <atom:link href="http://bill.welliver.org/rss/smartos/Bhyve-ready NetBSD Images" type="application/rss+xml"></atom:link>
  <atom:generator uri="http://modules.gotpike.org/blahblah/Public.Syndication.ATOM" version="0.1">Public.Syndication.ATOM (Pike v8.0 release 702)</atom:generator>
  <atom:icon>http://bill.welliver.org/favicon.ico</atom:icon>
  <atom:logo>http://bill.welliver.org/static/images/alchemy.gif</atom:logo>
  <atom:subtitle type="xhtml"><html:div xmlns:html="http://www.w3.org/1999/xhtml"><html:p>I've put together some bhyve images of NetBSD for use with MNX Triton Datacenter and SmartOS. They include a pre-configured cloud-init and should be fairly well integrated with Triton.</html:p><html:p class="paragraph"/>
The latest images are available for NetBSD 10.1 and contain the following:&#xD;
<html:ul class="minus">
<html:li>Base OS install, plus compiler and headers, plus man pages on a 10GB image.</html:li>
<html:li>Virtio disk and networking</html:li>
<html:li>Integration using cloud-init configured for SmartOS/Triton (root password and ssh key, data disk preparation, etc)</html:li>
<html:li>mdata client installed, example use is in /etc/cloud/cloud.cfg</html:li>
<html:li>root and data disk resize checks on startup</html:li>
<html:li>pkgsrc/pkgin installed and ready to go</html:li>
<html:li>mozilla-rootcerts installed and set up</html:li>
<html:li>Serial console configured for use with vmadm console</html:li>
<html:li>UEFI boot</html:li>
</html:ul>I'm hosting the image on my IMGAPI server. You can add it as a source to your imgadm:<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
root@headnode# imgadm source -a http:<html:font color="red">//images.welliver.org&#xD;
</html:font></html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
Here's the current list of images:<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
root@headnode<html:font color="brown"># imgadm avail | grep netbsd&#xD;
</html:font>3a362e0e-afaf-11ed-97b3-cfb1bff0c1d0  netbsd-9.3-cloudimage           20230219                                    bsd      zvol          2023-02-19&#xD;
caf6d5d6-69c2-11f0-a449-c7e57fb31843  netbsd-10.1-cloudimage           20250726                                    bsd      zvol          2025-07-26&#xD;
</html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
These images are intended to be light weight, so only the minimum install sets (plus the compiler and headers, necessary for building software). Here's an example of how to add other installation sets:<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
root# cd / &amp;&amp; curl -L http:<html:font color="red">//mirror.planetunix.net/pub/NetBSD/NetBSD-10.1/amd64/binary/sets/ttxt.tar.xz | tar xzvf -&#xD;
</html:font></html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
I've tested both images as a pkgsrc build platform and they work at least as well as my previous virtual environment running on VMWare.<html:p class="paragraph"/>
<html:h3 class="heading-1.1">An important note regarding security</html:h3><html:p class="paragraph"/>
By default, NetBSD does not assign a password to the root user. This means that unless the password is changed, anyone with console access can log in as root. Generally, anyone in the wheel group can su to root without being prompted for a password. A user, "netbsd" is also created as the recommended login approach. This user will also have ssh keys installed, but by default has no password.<html:p class="paragraph"/>
The images generated will automatically set a root password if it's provided in the instance metadata. This happens automatically in Triton, but it also works with SmartOS if it's provided in the instance information (see the example below for how to do this).<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
<html:font color="brown"># insert this code into your vm json to pass a root (or other) passwords &#xD;
</html:font><html:font color="brown"># and authorized keys on to the vm tools (cloud init and friends)&#xD;
</html:font>  <html:i><html:font color="darkred">"internal_metadata"</html:font></html:i>: { <html:i><html:font color="darkred">"root_pw"</html:font></html:i>: <html:i><html:font color="darkred">"f00Bar"</html:font></html:i> },&#xD;
  <html:i><html:font color="darkred">"customer_metadata"</html:font></html:i>: {&#xD;
    <html:i><html:font color="darkred">"root_authorized_keys"</html:font></html:i>: <html:i><html:font color="darkred">"ssh-rsa YOURPUBLICKEY foo@bar.org"</html:font></html:i>&#xD;
  }&#xD;
</html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
Also note, the metadata client is executable by anyone, so even if the password is set, it relies on the security of the communication port (/dev/tty01) and thus //could// be easy to retrieve, unless it's been changed. This seems to be the case with all image types, and again, the only protection comes from the permission set on the metadata socket or device.<html:p class="paragraph"/>
<html:h3 class="heading-1.1">How the images are built</html:h3><html:p class="paragraph"/>
The image build script must be run from a netbsd system, in order to format the ffs disk and install the netbsd boot loader. Additionally, cloud-init installation won't be successful if the current NetBSD version isn't the same as the image we're building (point releases may work, however). Thus, building an image is a two-step process: create an image on a vm running a previous NetBSD release, and then boot into that and run the image builder in order to get a fully functional image. The interim image won't have networking automatically set up, so there's some legwork that needs to be done there. It's unclear what the right approach is, ditching cloud-init or automating more of the process. Given that major releases happen once every 2-3 years, it may not be worth the effort to try to improve the process.<html:p class="paragraph"/>
So, start by cloning the following repository on a NetBSD system:<html:p class="paragraph"/>
<html:span class="nobr"><html:img height="9" width="8" src="/static/images/Icon-Extlink.png" alt="[external]"/><html:a href="https://git.sr.ht/~hww3/netbsd-cloud-images">https://git.sr.ht/~hww3/netbsd-cloud-images</html:a></html:span><html:p class="paragraph"/>
Edit the script for the version of NetBSD you'd like to use and to make any changes, and then (as root) run build.sh. This should create a new blank UEFI-based NetBSD install with everything configured for the first run. The result will be a raw image called "final.raw".<html:p class="paragraph"/>
Copy this to your smartos/triton headnode and create a blank bhyve vm (take the script and template from the repository above):<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
./bhyve_import_raw_image.sh final.raw netbsd-10.1-cloudimage 10.1 netbsd-cloudimage-template.json &#xD;
</html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
Adapted from the following source:&#xD;
<html:span class="nobr"><html:img height="9" width="8" src="/static/images/Icon-Extlink.png" alt="[external]"/><html:a href="https://github.com/virt-lightning/netbsd-cloud-images">https://github.com/virt-lightning/netbsd-cloud-images</html:a></html:span><html:p class="paragraph"/>
<html:h3 class="heading-1.1">Notes for creating the initial image:</html:h3><html:p class="paragraph"/>
NetBSD DVD install images are UEFI ready starting with NetBSD 9.0, so we can finally use BHYVE for the entire process. An image from the previous version of NetBSD can be used, as described above, so the following isn't relevant unless you like doing things the hard way.<html:p class="paragraph"/>
<html:i class="ital">NOTE</html:i>: the build vms don't need to be built on smartos, or even bhyve. You can generate the "final.raw" image on VMware or UTM, etc if that's easier.<html:p class="paragraph"/>
A key trick is to make sure that the CD drive is located at a high PCI slot to ensure it gets priority:<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
UUID=youInstanceUUID&#xD;
ISO=<html:i><html:font color="darkred">"NetBSD-9.3-amd64.iso"</html:font></html:i>&#xD;
cp $ISO /zones/$UUID/root/&#xD;
vmadm update $UUID bhyve_extra_opts=<html:i><html:font color="darkred">"-s 7:0,ahci-cd,/$ISO"</html:font></html:i>&#xD;
vmadm start $UUID&#xD;
vmadm update $UUID bhyve_extra_opts=<html:i><html:font color="darkred">""</html:font></html:i>&#xD;
</html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
You can use VNC to perform the original install. Not all VNC clients work equally well. I've had good luck with TigerVNC, but not with MacOS Screen Sharing and the "official" VNC client. Chicken also worked well, but is no longer supported on recent MacOS.&#xD;
</html:div></atom:subtitle>
</atom:feed>
